<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>JFinal--Controller</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="assets/js/jquery.js"></script>
<style type="text/css">
</style>
</head>

<body>
	<div style="width:500px;">
		<h2>JFinal Controller 传参</h2>
		<hr>
		<fieldset>
			<legend>URL 超链接 浏览器通过URL链接地址传参</legend>
			一个参数：<br> <a href="/param/urloneparam?param=1" target="_blank">/param/urloneparam?param=1</a><br>
			<a href="/param/urloneparam/1" target="_blank">/param/urloneparam/1</a>
			<hr />
			多个参数：<br> <a href="/param/urlmoreparam?param1=1&param2=2"
				target="_blank">/param/urlmoreparam?param1=1 & param2=2</a><br>
			<a href="/param/urlmoreparam/1-2" target="_blank">/param/urlmoreparam/1-2</a>
		</fieldset>

		<fieldset>
			<legend>Form表单 Post提交</legend>
			<form action="/param/form" method="post" target="_blank">
				<table style="text-align: left;">
					<tr>
						<td>姓名:</td>
						<td><input type="text" name="name" /></td>
					</tr>
					<tr>
						<td>年龄:
					</td>
					<td><input type="text" name="age" /></td>
					</tr>
					<tr>
						<td>生日:
					</td>
					<td><input type="date" name="birthday" /></td>
					</tr>
					<tr>
						<td>部门:
					</td>
					<td>
					<select  name="department">
					<option>=选择部门=</option>
					<option value="1">研发部</option>
					<option value="2">销售部</option>
					<option value="3">市场部</option>
					</select>
					</td>
					</tr>
					<tr>
						<td>职位:
					</td>
					<td><select  name="posation">
					<option>=选择职位=</option>
					<option value="1">部门经理</option>
					<option value="2">经理助理</option>
					<option value="3">普通职员</option>
					</select></td>
					</tr>
					<tr>
						<td>简介:</td>
						<td><textarea name="desc" style="width: 200px;height:60px;"></textarea></td>
					</tr>
					<tr>
						<td colspan="2" align="center"><input type="submit"
							value="提交">&nbsp;&nbsp;<input type="reset" value="重置"></td>
					</tr>
  			</table>
 		</form>
  </fieldset>
  <fieldset>
  	<legend>AJAX异步提交</legend>
  	<button id="ajaxgetBtn">AJAX GET</button>
  	<button id="ajaxpostBtn">AJAX POST</button>
  	<fieldset>
  	<legend>AJAX 结果</legend>
  	<div id="ajaxresult" style="width: 200px;height:80px;border: 1px solid #CCC;margin-top: 5px;">
  	</div>
  	</fieldset>
  	<script type="text/javascript">
				$(function() {
					$("#ajaxgetBtn").click(function() {
						$("#ajaxresult").html("");
						$.ajax({
							type : "get",
							url : "/param/ajaxget?param=1",
							dataType : "json",
							success : function(result) {
								$("#ajaxresult").html(result.msg);
							}
						});
					});
					$("#ajaxpostBtn").click(function() {
						$("#ajaxresult").html("");
						$.ajax({
							type : "post",
							url : "/param/ajaxpost",
							data : {param1:1,param2:2},
							dataType : "json",
							success : function(result) {
								$("#ajaxresult").html(result.msg);
							}
						});
					});

				});
			</script>
  </fieldset>
  </div>
  </body>
</html>
